﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IMS_Data;

namespace IMS_WEB
{
    public partial class NewCustomer : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

            Submit1.Value = "添加";

        }

        private void AddNewCompany()
        {
            company cp = GetCompany();
            CompanyReposity cr = new CompanyReposity();
            cr.AddCompany(cp);
            ClientScript.RegisterStartupScript(Submit1.GetType(), "", "<script>alert('添加成功!')</script>");
        }

       

        private company GetCompany()
        {
            company cp = new company();
            cp.company_address = tbCAddress.Value;
            cp.company_bankAccount = tbAccount.Value;
            cp.company_bankName = tbBankName.Value;
            cp.company_contactName = tbContact.Value;
            cp.company_contactPhone = tbContactPhone.Value;
            cp.company_fax = tbFax.Value;
            cp.company_mailCode = tbMailCode.Value;
            cp.company_name = tbCName.Value;
            cp.company_person = tbCProxy.Value;
            cp.company_phone = tbPhone.Value;
            cp.company_proxy = tbCProxyName.Value;
            cp.remarks = tbRemark.Value;
            cp.company_tax = tbTaxNumber.Value;
            return cp;
        }

        protected void Submit1_Serverclick(object sender, EventArgs e)
        {

               AddNewCompany();
            

        }
    }
}